//
//  GiftNomalCell.m
//  YUXiu
//
//  Created by wang on 16/6/28.
//  Copyright © 2016年 Wang. All rights reserved.
//

#import "GiftNomalCell.h"

@implementation GiftNomalCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    
    
    
    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //
        
        _numLabel = [[UILabel alloc]initWithFrame:krect(8, 20, 42, 20)];
        _numLabel.font = Font(17);
        [self.contentView addSubview:_numLabel];
//        头像
        _levIcon = [[UIImageView alloc]initWithFrame:krect(_numLabel.golf_right+5, 10, 40, 40)];
        _levIcon.layer.cornerRadius = 20;
        _levIcon.clipsToBounds = YES;
        [self.contentView addSubview:_levIcon];
        
        _scoreLabel = [[UILabel alloc]initWithFrame:krect(kScreenWidth-105, 20 , 100, 20)];
        _scoreLabel.font = Font(12);
        _scoreLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_scoreLabel];
        
        //
        _levButton = [[UIButton alloc]initWithFrame:krect(kScreenWidth/2, 20, 60, 20)];
        [_levButton setTitle:@"Button" forState:UIControlStateNormal];
        [_levButton setBackgroundColor:kOrangeCOLOR];
        [self.contentView addSubview:_levButton];
//73
        _sexIcon = [[UIImageView alloc]initWithFrame:krect(_levButton.golf_left -22, 20, 20, 20)];
        [self.contentView addSubview:_sexIcon];

        NSLog(@"sexicon:%f",_sexIcon.golf_left-_levIcon.golf_right);
        _fansLabel = [[UILabel alloc]initWithFrame:krect( _levIcon.golf_right, 20, _sexIcon.golf_left - _levIcon.golf_right, 20)];
        _fansLabel.font = Font(12);
        _fansLabel.textColor = kOrangeCOLOR;
        _fansLabel.backgroundColor = kNaviBarCOLOR;
        _fansLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_fansLabel];

       
    }
    
    return self;
}

-(void)layoutSubviews{
    _numLabel.text = @"NO.4";
    [_levIcon setImage:kCreatImage(@"002")];
    _scoreLabel.text = @"贡献200023积分";
    [_sexIcon setImage:kCreatImage(@"gift")];
    NSString * str = @"随心所动111";
    _fansLabel.text = str;

    
    float wd = [str boundingRectWithSize:CGSizeMake(999, 20) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : Font(12)} context:nil].size.width;
    if (wd > _fansLabel.golf_width) {
        
        _fansLabel.adjustsFontSizeToFitWidth = YES;
  
    }
   

    
    
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
